home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 9 / FM Towns Free Software Collection 9.iso / t_os / data / fapx / fapxmail.plp < prev    next >
Text File  |  1994-11-16  |  11KB  |  500 lines

  1. /************************************************************************
  2. *    未読メールの処理                        *
  3. *************************************************************************/
  4. /*    Down all text of one mail    */
  5. /*    圧縮するモード    */
  6. %AllText{
  7.     loop    ({
  8.         wait    (Wtime2*5,{break;im({Yes})},
  9.             {\n\n},
  10.             {
  11.             MLcnt:=MLcnt-1;
  12.             write(TEMP2|{fapxmail.eml},CRLF);
  13.             receive(TEMP2|{fapxmail.eml});
  14.             wait    (,,
  15.                 {    題名:},
  16.                 {
  17.                 wait    (Wtime2,
  18.                     {AbortOff(
  19.                     {\nホストの反応が鈍いよぉ~\n})},
  20.                     {\n},
  21.                     {
  22.                     %a @laststr(128);
  23.                     %b @getchar(@getline
  24.                         (a,@noline(a)-2),4,17);
  25.                     case    (b={ -              P},
  26.                         {Yes},
  27.                         {
  28.                         TITLE:={ }|@getchar(@getline(a,
  29.                             @noline(a)-2),20,12)|
  30.                             {     }|
  31.                             @tail(a,{題名:},{\n});
  32.                         },
  33.                         {No},
  34.                         {
  35.                         TITLE:=b|{ }|
  36.                             @tail(a,{題名:},{\n});
  37.                         });
  38.                     });
  39.                 loop    ({
  40.                 wait    (,,
  41.                     {  E:終了)\n:},
  42.                     {
  43.                     %a    @laststr;
  44.                     wait(2);
  45.                     %b    @laststr;
  46.                     case    (a=b,
  47.                         {No},{im({Yes})},
  48.                         {Yes},
  49.                         {
  50.                         stoprec;
  51.                         %file    @nowfile2(TEMP2|
  52.                             {fapxmail.eml},TEMP);
  53.                         write(LOG2|{TITLE\NIFMAIL.TXT},
  54.                             file|{ }|TITLE|{ \n});
  55.                         delfile(TEMP2|{fapxmail.eml});
  56.                         type({2\n});
  57.                         im({No})
  58.                         })
  59.                     },
  60.                     {NAPLPSのデコーダーが必要です。}|
  61.                         {準備 (1:OK  2:NG) \n:},
  62.                     {
  63.                     type({1\n});wait(5);type({\n});
  64.                     wait    (,,
  65.                         {  E:終了)\n:},
  66.                         {
  67.                         stoprec;
  68.                         setcdir(CDIR);
  69.                         dispoff(!DEBUG);
  70.                         command({txl -npcut }|
  71.                         { -i }|TEMP2|{fapxmail.eml}|
  72.                         { -o }|TEMP2|{fapxmail.npb});
  73.                         dispoff({No});
  74.                         %file    @nowfile2(TEMP2|
  75.                             {fapxmail.npb},TEMP);
  76.                         delfile(TEMP2|{fapxmail.eml});
  77.                         delfile(TEMP2|{fapxmail.npb});
  78.                         write(LOG2|{TITLE\NAPMAIL.TXT},
  79.                             file|{ }|TITLE|{ \n});
  80.                         type({2\n});
  81.                         im({No})
  82.                         });
  83.                     },
  84.                     {続き (改行で表示 E:終了)\n>},
  85.                     {
  86.                     %a    @laststr;
  87.                     wait(2);
  88.                     %b    @laststr;
  89.                     case    (a=b,
  90.                         {No},{im({Yes})},
  91.                         {Yes},{type({\n});im({Yes})});
  92.                     },
  93.                     {◆次頁はありません◆\n>},
  94.                     {
  95.                     %a    @laststr;
  96.                     wait(2);
  97.                     %b    @laststr;
  98.                     case    (a=b,
  99.                         {No},{im({Yes})},
  100.                         {Yes},{im({No})});
  101.                     })
  102.                     });
  103.                 });
  104.             im({Yes});
  105.             },
  106.             {はバイナリーのため、表示出来ません◆\n},
  107.             {BMcnt:=BMcnt+1;MLcnt:=MLcnt-1;im({Yes})},
  108.             {続き (改行で表示 E:終了)\n>},
  109.             {
  110.             %a    @laststr;
  111.             wait(2);
  112.             %b    @laststr;
  113.             case    (a=b,
  114.                 {No},{im({Yes})},
  115.                 {Yes},{type({\n});im({Yes})}
  116.                 );
  117.             },
  118.             {◆次頁はありません◆\n>},
  119.             {
  120.             %a    @laststr;
  121.             wait(2);
  122.             %b    @laststr;
  123.             case(a=b,{No},{im({Yes})},{Yes},{im({No})});
  124.             },
  125.             {(1:受信 2:送信 3:送信簿 0:その他 E:終了)\n>},
  126.             {case(MLcnt>0,{Yes},{im({Yes})},{No},{im({No})})},
  127.             {E. 終了\n>},
  128.             {
  129.             %a    @laststr;
  130.             wait(2);
  131.             %b    @laststr;
  132.             case(a=b,{No},{im({Yes})},{Yes},{im({No})});
  133.             });
  134.         });
  135.     };
  136.  
  137. /*    圧縮しないモード    */
  138. %AllText2{
  139.     loop    ({
  140.         wait    (Wtime2*5,{break;im({Yes})},
  141.             {\n\n},
  142.             {
  143.             MLcnt:=MLcnt-1;
  144.             write(LOG2|{NIFMAIL\}|File,CRLF);
  145.             receive(LOG2|{NIFMAIL\}|File);
  146.             wait    (,,
  147.                 {    題名:},
  148.                 {
  149.                 wait    (Wtime2,
  150.                     {AbortOff(
  151.                     {\nホストの反応が鈍いよぉ~\n})},
  152.                     {\n},
  153.                     {
  154.                     %a @laststr(128);
  155.                     %b @getchar(@getline
  156.                         (a,@noline(a)-2),4,17);
  157.                     case    (b={ -              P},
  158.                         {Yes},
  159.                         {
  160.                         TITLE:={ }|@getchar(@getline(a,
  161.                             @noline(a)-2),20,12)|
  162.                             {     }|
  163.                             @tail(a,{題名:},{\n});
  164.                         },
  165.                         {No},
  166.                         {
  167.                         TITLE:=b|{ }|
  168.                             @tail(a,{題名:},{\n});
  169.                         });
  170.                     });
  171.                 loop    ({
  172.                 wait    (,,
  173.                     {  E:終了)\n:},
  174.                     {
  175.                     %a    @laststr;
  176.                     wait(2);
  177.                     %b    @laststr;
  178.                     case    (a=b,
  179.                         {No},{im({Yes})},
  180.                         {Yes},
  181.                         {
  182.                         stoprec;
  183.                         write(LOG2|{NIFMAIL\TITLE.TXT},
  184.                             File|{ }|TITLE|{ \n});
  185.                         File:=@crefile(LOG2|{NIFMAIL},
  186.                             {eml});
  187.                         type({2\n});
  188.                         im({No})
  189.                         })
  190.                     },
  191.                     {NAPLPSのデコーダーが必要です。}|
  192.                         {準備 (1:OK  2:NG) \n:},
  193.                     {
  194.                     stoprec;
  195.                     delfile(LOG2|{NIFMAIL\}|File);
  196.                     %File2 @crefile(TEMP,{NPB});
  197.                     receive(TEMP2|File2);
  198.                     type({1\n});wait(5);type({\n});
  199.                     wait    (,,
  200.                         {  E:終了)\n:},
  201.                         {
  202.                         stoprec;
  203.                         %File3 @crefile(LOG2|{NAPMAIL},
  204.                             {NPB});
  205.                         mkdir2(LOG2|{NAPMAIL});
  206.                         setcdir(CDIR);
  207.                         dispoff(!DEBUG);
  208.                         command({txl -npcut}|{ -i }|
  209.                             TEMP2|File2|{ -o }|
  210.                             LOG2|{NAPMAIL\}|File3);
  211.                         dispoff({No});
  212.                         delfile(TEMP2|File2);
  213.                         write(LOG2|{NAPMAIL\TITLE.TXT},
  214.                             File3|{ }|TITLE|{ \n});
  215.                         type({2\n});
  216.                         im({No})
  217.                         });
  218.                     },
  219.                     {続き (改行で表示 E:終了)\n>},
  220.                     {
  221.                     %a    @laststr;
  222.                     wait(2);
  223.                     %b    @laststr;
  224.                     case    (a=b,
  225.                         {No},{im({Yes})},
  226.                         {Yes},{type({\n});im({Yes})});
  227.                     },
  228.                     {◆次頁はありません◆\n>},
  229.                     {
  230.                     %a    @laststr;
  231.                     wait(2);
  232.                     %b    @laststr;
  233.                     case    (a=b,
  234.                         {No},{im({Yes})},
  235.                         {Yes},{im({No})});
  236.                     })
  237.                     });
  238.                 });
  239.             im({Yes});
  240.             },
  241.             {はバイナリーのため、表示出来ません◆\n},
  242.             {BMcnt:=BMcnt+1;MLcnt:=MLcnt-1;im({Yes})},
  243.             {続き (改行で表示 E:終了)\n>},
  244.             {
  245.             %a    @laststr;
  246.             wait(2);
  247.             %b    @laststr;
  248.             case    (a=b,
  249.                 {No},{im({Yes})},
  250.                 {Yes},{type({\n});im({Yes})}
  251.                 );
  252.             },
  253.             {◆次頁はありません◆\n>},
  254.             {
  255.             %a    @laststr;
  256.             wait(2);
  257.             %b    @laststr;
  258.             case(a=b,{No},{im({Yes})},{Yes},{im({No})});
  259.             },
  260.             {(1:受信 2:送信 3:送信簿 0:その他 E:終了)\n>},
  261.             {case(MLcnt>0,{Yes},{im({Yes})},{No},{im({No})})},
  262.             {E. 終了\n>},
  263.             {
  264.             %a    @laststr;
  265.             wait(2);
  266.             %b    @laststr;
  267.             case(a=b,{No},{im({Yes})},{Yes},{im({No})});
  268.             });
  269.         });
  270.     };
  271.  
  272. %MailDown{
  273.     display({\nメールのダウンロードを開始します\n});
  274.     footnote({メールのダウンロード中});
  275.     case    (COMPRESS={Yes}&&ARCHIVER<>{},
  276.         {Yes},
  277.         {
  278.         mkdir2(LOG2|{TITLE});
  279.         delfile(TEMP2|{fapxmail.eml});
  280.         type({READ NEW\n});
  281.         AllText;
  282.         dispoff(!DEBUG);
  283.         command(ARCHIVER|{ a }|LOG2|{NIFMAIL.lzh }|TEMP2|{*.eml});
  284.         command(ARCHIVER|{ a }|LOG2|{NAPMAIL.lzh }|TEMP2|{*.npb});
  285.         command({del }|TEMP2|{*.eml});
  286.         dispoff({No});
  287.         },
  288.         {No},
  289.         {
  290.         mkdir2(LOG2|{NIFMAIL});
  291.         File:=@crefile(LOG2|{NIFMAIL},{eml});
  292.         type({READ NEW\n});
  293.         AllText2;
  294.         });
  295.     setcdir(CDIR);
  296.     };
  297.  
  298. %BMail2    {
  299.     var    n    [2];
  300.     %m    @noline(BMAILID)-1;
  301.     n:=m+1;
  302.     footnote({バイナリメールをダウンロードしています});
  303.     loop    ({
  304.         n:=n-1;
  305.         %bmail1    @getline(BMAILID,n,1);
  306.         %distype {type({DOWN }|@getchar(bmail1,1,8)|{ PROT:BPL\n})};
  307.         distype;footnote(@head(@getchar(bmail1,27),CRLF)|
  308.                 {(★中止 PUSH:[Cancel]→[No])});
  309.         loop    ({
  310.             wait    (Wtime1,{distype;im({Yes})},
  311.                 { (改行のみで終了)\n:},{im({No})})
  312.             });
  313.         %Fsize @tail(@laststr(128),{(BPLUS)\n},{バイト});
  314.         File:=    @head(@getchar(bmail1,27),{ });
  315.         case(@nochar(@tail(File,{.}))>3||@nochar(@head(File,{.}))>8,
  316.             {Yes},{File:={}});
  317.         case    (COMPRESS={Yes}&&ARCHIVER<>{},
  318.             {Yes},
  319.             {
  320.             delfile(TEMP2|{fapxmail.bml});
  321.             %timeP    @linetime;
  322.             type(TEMP2|{fapxmail.bml\n});
  323.             wait    (,,
  324.                 {2:しない)\n:},
  325.                 {
  326.                 %timePS    @linetime-timeP;
  327.                 UPDNRATE({down},{fapxmail.bml},Fsize,timePS);
  328.                 setcdir(TEMP);
  329.                 %file    @nowfile2(TEMP2|{fapxmail.bml},TEMP);
  330.                 dispoff(!DEBUG);
  331.                 command(ARCHIVER|{ a }|LOG2|
  332.                     {NIFBMAIL.lzh }|TEMP2|file);
  333.                 dispoff({No});
  334.                 delfile(TEMP2|file);
  335.                 write(LOG2|{TITLE\NIFBMAIL.TXT},
  336.                     file|{  }|@getchar(bmail1,10));
  337.                 setcdir(CDIR);
  338.                 type({2\n});WAITABORT(Wtime2);
  339.                 },
  340.                 {E:終了)\n>}
  341.                 );
  342.             },
  343.             {No},
  344.             {
  345.             mkdir2(LOG2|{Nifbmail});
  346.             case(File={}||@filechk(File)={Yes},{Yes},
  347.                 {File:=@crefile(LOG2|{NIFBMAIL},{bml})});
  348.             %timeP    @linetime;
  349.             type(LOG2|{NIFBMAIL\}|File|{\n});
  350.             wait(,,{2:しない)\n:},
  351.                 {
  352.                 %timePS    @linetime-timeP;
  353.                 UPDNRATE({down},File,Fsize,timePS);
  354.                 write(LOG2|{NIFBMAIL\TITLE.TXT},
  355.                     File|{  }|@getchar(bmail1,10));
  356.                 type({2\n});WAITABORT(Wtime2);
  357.                 },
  358.                 {E:終了)\n>}
  359.                 );
  360.             });
  361.         im(n>1);
  362.         });
  363.     };
  364.  
  365. %BMail    {
  366.     var    BMAILID    [3000];
  367.     BMAILID:={};
  368.     type({LIST\n});
  369.     wait    (Wtime2,{AbortOff({\nホストの反応が鈍いよぉ~\n})},
  370.         {識別子\n},{});
  371.     loop    ({
  372.         wait    (Wtime2,{AbortOff({\nホストの反応が鈍いよぉ~\n})},
  373.             {\n},
  374.             {
  375.             %line1    @body(@laststr(90),{\n},{\n});
  376.             case    (@getchar(line1,1,1)={ }&&
  377.                 @getchar(line1,30,1)={B},
  378.                 {Yes},
  379.                 {
  380.                 BMcnt:=BMcnt-1;
  381.                 BMAILID:=BMAILID|
  382.                     @getchar(line1,72,8)|{ }|
  383.                     @getchar(line1,7,16)|{ }|
  384.                     @getchar(line1,32,40)|CRLF;
  385.                 im({Yes});
  386.                 },
  387.                 {No},
  388.                 {
  389.                 case    (@getchar(line1,49,8),
  390.                     {E:終了)},
  391.                     {wait(,,{>},);im({No})},
  392.                     ,
  393.                     {
  394.                     case    (BMcnt<1,{Yes},
  395.                         {
  396.                         break;
  397.                         WAITABORT(Wtime2);
  398.                         im({No});
  399.                         },
  400.                         {No},{im({Yes})}
  401.                         );
  402.                     });
  403.                 });
  404.             });
  405.         });
  406.     case(DEBUG,{Yes},{display({BMAILID=「}|BMAILID|{」\n})});
  407.     case(BMAILID<>{},{Yes},{BMail2});
  408.     };
  409.  
  410. %MAIL    {
  411.     case    (MLcnt,-1,
  412.         {type({MCHK\n});
  413.         wait    (Wtime2,
  414.             {AbortOff({\nホストの反応が鈍いよぉ~\n})},
  415.             {通)--},
  416.             {
  417.             MLcnt:=@head(@body(@laststr,{(未読分}),{通)-})+1-1;
  418.             WAITABORT(Wtime2);
  419.             },
  420.             {通届いています-},
  421.             {WAITABORT(Wtime2)},
  422.             {-あなた宛のメールはありません},
  423.             {WAITABORT(Wtime2)},
  424.             )
  425.         });
  426.     /*display({MLcnt:=}|MLcnt|{\n});*/
  427.     case    (MLcnt>0,{Yes},
  428.         {
  429.         footnote({メールをダウンロードしています});
  430.         BMcnt:=0;
  431.         case    (@GO({mail}),
  432.             {Yes},
  433.             {
  434.             MailDown;
  435.             case    (BMcnt!=0&&MAILDOWN={Yes}&&
  436.                 ((BMAILDWN<>{Discount}||
  437.                 (BMAILDWN={Discount}&&
  438.                 @discntime(@daylong)))),
  439.                 {Yes},{BMail});
  440.             });
  441.         });
  442.     };
  443.  
  444. /*    既読メールの削除処理    */
  445. %DELmail{
  446.     display({既読メールの削除を行います\n});
  447.     footnote({既読メールの削除処理中});
  448.     case    (@GO({mail}),
  449.         {Yes},
  450.         {
  451.         type({DEL ALL\n});
  452.         loop    ({
  453.             wait    (Wtime2,{\nホストの反応が鈍いよぉ~\n},
  454.                 {\n*},
  455.                 {
  456.                 wait    (Wtime2,{\nホストの反応が鈍いよぉ~\n},
  457.                     {削除 (1:削除する 2:しない)\n:},
  458.                     {type({1\n})}
  459.                     );
  460.                 im({Yes});
  461.                 },
  462.                 {\n },
  463.                 {
  464.                 wait    (Wtime2,{\nホストの反応が鈍いよぉ~\n},
  465.                     {削除 (1:削除する 2:しない)\n:},
  466.                     {type({2\n})}
  467.                     );
  468.                 im({Yes});
  469.                 },
  470.                 {0:その他 E:終了)\n>},
  471.                 {im({No})}
  472.                 );
  473.             });
  474.         });
  475.     };
  476.  
  477. /*    メールの送信簿を確認する    */
  478. %CHKsdl    {
  479.     display({メール送信簿を確認します\n});
  480.     footnote({メール送信簿を確認しています});
  481.     case    (@GO({mail}),
  482.         {Yes},
  483.         {
  484.         LOGforum({MAILSDL},{start});
  485.         type({SDL\n});
  486.         WAITABORT(Wtime2);
  487.         LOGforum({MAILSDL},{stop});
  488.         });
  489.     };
  490.  
  491. var    BMcnt    [2];    /* 未読バイナリメール数        */
  492. var    BMAILNO    [2];    /* 未読バイナリメール番号    */
  493. var    File    [12];    /* ダウンロードファイル名    */
  494. var    Type    [1];    /* メールタイプ(Binary/Naplps)    */
  495. var    TITLE    [80];    /* メールの題名            */
  496.  
  497. case(MAILDEL,{Yes},{DELmail});
  498. case(CHKSDL,{Yes},{CHKsdl});
  499. MAIL;
  500.